Repository navigation
fix(id-events): stream device-op recovery instead of collecting the history (#11299) - #11432
Merged
Merged
Conversation
…istory (#11299) recover_device_ops decoded every EVENTS row into a Vec, then staged every recovered row in another Vec before writing, all inside the startup write transaction. A large unpruned store needed memory proportional to its whole history to open. The scan now walks EVENTS one row at a time and writes each recovered row as it is found, in the same transaction. Only the waiting rows are collected, and the waiting pool is capped. The verified-body check, the recovered count, the incomplete report and the once-only marker are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dezren39
marked this pull request as ready for review
November 17, 2026 22:35
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11299
Before: opening an event store ran
recover_device_ops, which decoded everyEVENTSrow into aVec<Event>, then staged every recovered device-op row in a secondVecbefore writing any, all inside the startup write transaction. An unpruned store needed memory proportional to its whole history just to open.After: recovery walks
EVENTSone row at a time and writes each recovered row as soon as it is found, still inside the single startup transaction. Nothing proportional to the history is held. Only the waiting rows are collected first, and the waiting pool is already capped byWaitingLimits.How:
recover_device_opsinpkgs/id/crates/id-events/src/event_store/ingest.rsnow iterates the table directly and calls a newrecover_oneper event. The verified-body check, the recovered count, the incomplete-recovery warning and the once-only marker behave as before. One small improvement falls out: an id seen twice is now counted once, because its row exists by the second visit.Testing: new
test_open_recovers_device_operations_across_a_long_historyingests 200 grants, strips their device-op rows and 10 bodies, reopens, and checks 190 rows come back, the 10 are reported incomplete, and a forced rerun recovers 0 and adds no rows.cargo test -p id-events: 328 pass.This is a constant-space scan in one transaction rather than batched transactions, so the transactional guarantee in the issue's last criterion holds as it did.
Generated by Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.